﻿using System;
using System.Collections.Generic;
using System.Text;
using Sinacor.Service.Infra.AuthorizationService.BusinessEntity;
using Sinacor.Infra.Service.Security.Authorization;

namespace Sinacor.Service.Infra.AuthorizationService.BusinessLogic
{
	public class User
	{
        public BusinessEntity.User RetrieveUser()
		{
            ResourceAccess.User user = new ResourceAccess.User();
            return user.RetrieveUser(AuthorizationContext.Current.UserId);
		}

		public List<BusinessEntity.UserRoles> RetrieveUserRoles(BusinessEntity.UserRoles request)
		{
			List<BusinessEntity.UserRoles> userRoles = new List<UserRoles>();
			foreach (string ur in AuthorizationContext.Current.RetrieveUserRoles(request.ModuleId))
			{
				BusinessEntity.UserRoles userRole = new UserRoles();
				userRole.Role = ur;
				userRoles.Add(userRole);
			}
			return userRoles;
		}
	}
}